package A;

import java.util.Arrays;

public class ArrayDemo {
    public static void main(String[] args) {
        int[] arr ={1,2,3,4,5};
        int[] arr2 = new int[6];
//        System.arraycopy(arr,0,arr2,0,arr.length);
//        arr = arr2;
//        System.out.println("arr扩容后:" + Arrays.toString(arr));
        arr = Arrays.copyOf(arr,arr.length+1);
        System.out.println("arr扩容后:" + Arrays.toString(arr));
    }
}
